class Admin::PodcastsController < ApplicationController
  layout "admin"
  
  skip_before_filter :verify_authenticity_token
  
  helper :button
  
  before_filter :login_required
  
  access_control :DEFAULT => 'admin | podcast'
  
  resource_this :will_paginate => true, :path_prefix => 'admin_'
  
  def auto_complete_for_tag_name
    find_options = { 
      :conditions => [ "LOWER(name) LIKE ?", '%' + params[:podcast][:tag_list].downcase + '%' ], 
      :order => "name ASC",
      :limit => 10 }
    @items = Tag.find(:all, find_options)
    render :inline => "<%= auto_complete_result @items, 'name' %>"
  end
  
  before_filter :set_user, :only => [:new]
  
  def set_user
    @podcast.author = current_user
  end
  
end
